# Maintainer: 

_realname=gtkglarea
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.1.0
pkgrel=1
pkgdesc="opengl area for gtk2 (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32')
url="http://www.student.oulu.fi/~jlof/gtkglarea/"
license=("spdx:LGPL-2.0-or-later")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-autotools"
  "${MINGW_PACKAGE_PREFIX}-cc"
  "${MINGW_PACKAGE_PREFIX}-pkgconf"
)
depends=(
  "${MINGW_PACKAGE_PREFIX}-gtk2"
  "${MINGW_PACKAGE_PREFIX}-gdk-pixbuf2"
)
source=("https://download.gnome.org/sources/gtkglarea/2.1/gtkglarea-${pkgver}.tar.xz"
        "001-mingw-autotools.patch")
sha256sums=('8e1e545877d2f5139300b54c2e3bcd70acf7d80a78421a894192186a64db82de'
            '5d49b9783646abc4be997382f1a09e7de36a476901cbf8aeee158d6bcf66b120')

prepare() {
  cd "${srcdir}/gtkglarea-${pkgver}"
  patch -Np1 -i "${srcdir}/001-mingw-autotools.patch"

  autoreconf -vfi
}

build() {
  cp -r "${srcdir}/gtkglarea-${pkgver}" "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"

  ./configure \
    --prefix="${MINGW_PREFIX}" \
    --build="${MINGW_CHOST}" \
    --host="${MINGW_CHOST}" \
   --with-lib-opengl32

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"

  mkdir -p "${pkgdir}${MINGW_PREFIX}/lib"
  make DESTDIR="${pkgdir}" install
}
